/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * adminInterface.java
 *
 * Created on 2011年4月9日, 下午10:35:17
 */

package csci3170;

import csci3170.adminInterface;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author KOLee
 */
public class adminInterface extends javax.swing.JFrame {

    /** Creates new form adminInterface */
    public adminInterface() {
        initComponents();

        jButton_Create.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              //  throw new UnsupportedOperationException("Not supported yet.");
               courseEnrollmentSystem s = courseEnrollmentSystem.getApplication();
               s.setInput(new String[]{"create"});
               String result =  s.getOutput().Check;

                if(result.equals("true")){
                    JOptionPane.showMessageDialog(null, "Successfully created!");
               }else{
                     JOptionPane.showMessageDialog(null, result);
               }
               System.out.println(result);
            }
        });

         jButton_Delete.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              //  throw new UnsupportedOperationException("Not supported yet.");
               courseEnrollmentSystem s = courseEnrollmentSystem.getApplication();
               s.setInput(new String[]{"delete"});
               String result =  s.getOutput().Check;
               if(result.equals("true")){
                    JOptionPane.showMessageDialog(null, "Successfully deleted!");
               }else{
                     JOptionPane.showMessageDialog(null, result);
               }
               System.out.println(result);
            }
        });

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton_Create = new javax.swing.JButton();
        jButton_Delete = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setBounds(new java.awt.Rectangle(0, 0, 0, 0));
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setName("Form"); // NOI18N
        setResizable(false);

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(csci3170.courseEnrollmentSystem.class).getContext().getResourceMap(adminInterface.class);
        jButton_Create.setText(resourceMap.getString("jButton_Create.text")); // NOI18N
        jButton_Create.setName("jButton_Create"); // NOI18N

        jButton_Delete.setText(resourceMap.getString("jButton_Delete.text")); // NOI18N
        jButton_Delete.setName("jButton_Delete"); // NOI18N

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(csci3170.courseEnrollmentSystem.class).getContext().getActionMap(adminInterface.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(99, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton_Delete, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton_Create, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(91, 91, 91))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(82, 82, 82)
                .addComponent(jButton_Create, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26)
                .addComponent(jButton_Delete, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(110, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
  /*  public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new adminInterface().setVisible(true);
            }
        });
    }*/

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton_Create;
    private javax.swing.JButton jButton_Delete;
    private javax.swing.JMenuBar menuBar;
    // End of variables declaration//GEN-END:variables

}
